﻿
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using CommonTagTime;
using CommonTagTime.ModelObject;
using CommonTagTime.Business;
namespace CommonTagTime.DataAccess
{
    public class daoShift
    {
        public daoShift()
        {

        }
        public ShiftCollection GetAll()
        {
            clsSQL clsSQL = new clsSQL();
            SqlDataReader de;
            ShiftCollection items = new ShiftCollection();

            try
            {

                de = clsSQL.SPDataReader("Shift_GetAll");
                while (de.Read())
                {
                    Shift item = Load(de);
                    items.Add(item);
                }

                de.Close();
                de.Dispose();
            }
            catch (Exception e)
            {
                clsFile.WriteLog("daoShift", "GetAll()", e.ToString());
            }
            finally
            {
                de = null;
                clsSQL.Dispose();
                clsSQL = null;
            }

            return items;
        }




        private Shift Load(IDataReader de)
        {
            Shift item = new Shift();

            item.ShiftId = clsConvert.DbToInt("ShiftId", de);
            item.Name = clsConvert.DbToString("Name", de);
            item.IsActive = clsConvert.DbToBoolean("IsActive", de);
            item.SortOrder = clsConvert.DbToInt("SortOrder", de);
            return item;
            // de.P
            //int intLogID = Convert.ToInt32(_comm.Parameters["@LogID"].Value);
        }








    }
}

